﻿using System;

namespace RuTracker.Interface
{
    public interface IUserRepository : IDisposable
    {
        /// <summary>
        /// returns true in case if user is already registered in system
        /// </summary>
        bool IsUserRegistered(string name);

        /// <summary>
        /// retrieve user by name and password, if there is no such user returns null
        /// </summary>
        User GetUser(string name);

        /// <summary>
        /// register new user
        /// </summary>
        User CreateUser(string name, string password, string email);

        /// <summary>
        /// Updates information about user
        /// </summary>
        /// <param name="user"></param>
        void UpdateUser(User user);

        /// <summary>
        /// set storage info for specific user
        /// </summary>
        void SetUserStorageInfo(string userName, string storageFolder, byte[] token);

        /// <summary>
        /// Gets user storage info for a specific user
        /// </summary>
        UserStorageInfo GetUserStorageInfo(string userName);

        /// <summary>
        /// Downloads torrent for user
        /// </summary>
        void DownloadTorrent(string userName, string torrentUrl);

        /// <summary>
        /// Gets user torrent information if it was already downloaded
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="torrentUrl"></param>
        /// <returns></returns>
        UserTorrent GetUserTorrent(string userName, string torrentUrl);
    }
}
